home *** CD-ROM | disk | FTP | other *** search
- #pragma once
-
- #define FILE_VERSION (1) /* version of File Library; incremented
- for every change to the FileType structure */
- #define FILE_CLOSED (0) /* reference number of closed files */
- #define FILE_BUFSIZ (512) /* size of input/output buffers */
-
- #define kFolderBit (4) /* bit in ioFlAttrib */
-
- /* Bits in the fdFlags field of the FInfo record. These don't seem to have
- been defined anywhere in the interface files, even though they're
- described in IM VI. */
-
- #define fIsAlias (1<<15) /* The file is an alias file. Reserved for
- directories in which case, set to 0. */
- #define fIsInvisible (1<<14) /* The file or directory is invisible from the
- Finder and from the Standard File Package
- dialog boxes. */
- /*#define fHasBundle (1<<13) /* The file contains a bundle resource.
- Reserved for directories—in which case,
- set to 0. */
- #define fNameLocked (1<<12) /* The file or directory can’t be renamed from
- the Finder and the icon cannot be changed. */
- #define fIsStationery (1<<11)/* The file is a stationery pad. Reserved for
- directories in which case, set to 0. */
- #define fHasCustomIcon (1<<10)/* The file or directory contains a customized
- icon. */
- #define fReserved9 (1<<9) /* Reserved; set to 0. */
- #define fHasBeenInited (1<<8) /* The Finder has recorded information
- from the file’s bundle into the desktop
- database and given the file or folder a
- position on the desktop. */
- #define fHasNoINITS (1<<7) /* The file contains no 'INIT' resources; set
- to 0. Reserved for directories; set to 0. */
- #define fIsShared (1<<6) /* The application is available to multiple
- users. Defined only for applications;
- otherwise, set to 0. */
- #define fReserved5 (1<<5) /* Reserved; set to 0. */
- #define fReserved4 (1<<4) /* Reserved; set to 0. */
- #define fColorBit3 (1<<3) /* Three bits of color coding. */
- #define fColorBit2 (1<<2) /* Three bits of color coding. */
- #define fColorBit1 (1<<1) /* Three bits of color coding. */
- #define fReserved0 (1<<0) /* Reserved; set to 0.*/
-
- typedef short FileVolType; /* volume reference number */
- typedef short FileRefType; /* file reference number */
- typedef long FileDirType; /* directory reference number */
- typedef short FileWDirType; /* working directory reference number */
- typedef long FilePosType; /* position in a file */
- typedef short FileSeekType; /* for setting position in a file */
- typedef SignedByte FilePermType; /* access permission */
- typedef CStr31 FileNameType; /* file name */
- typedef Str31 FilePNameType; /* file name (pascal string) */
- typedef CStr255 FilePathType; /* partial pathname */
- typedef Str255 FilePPathType; /* partial pathname (pascal string) */
-
- /* Structure describing a file on the Macintosh. When possible, you should
- use the functions provided in the File Library to manipulate files,
- passing a pointer to this structure as a parameter. This should
- help simplify keeping track of files, which otherwise may become
- totally confusing. You should avoid directly accessing any of the
- elements of a FileType structure. The first three fields of a FileType
- structure are similar to the three fields of an FSSpec structure,
- except that the name field of an FSSpec structure is of type Str63,
- while the pnm field of a FileType structure is of type Str31 (typedef'd
- to FilePNameType). */
- typedef struct {
- FileVolType vol; /* volume reference number */
- FileDirType dir; /* parent directory ID */
- FilePNameType pnm; /* name in Pascal string format */
- FileNameType cnm; /* name in C string format */
- FileRefType ref; /* reference number of open file */
- Boolean lock:1; /* if true, range locking is done before read/write */
- Boolean verify:1;/* if true, writes are verified */
- } FileType, *FilePtr, **FileHandle;
-
- Boolean FileValid(FileType *fp);
-
- void FileResolve(FileType *fp);
-
- const char *FileName(FileType *fp);
- const StringPtr FilePName(FileType *fp);
- void FileNameSet(FileType *fp, const FileNameType name);
- void FilePNameSet(FileType *fp, const FilePNameType name);
- void FileToFSSpec(FileType *fp, FSSpec *spec);
-
- void FileSet(FileType *fp, FileVolType vol, FileDirType dir, const FileNameType name);
- void FileSetWD(FileType *fp, FileWDirType wdref, const FileNameType name);
- void FileSetRef(FileType *fp, FileRefType ref);
- void FileSetFSSpec(FileType *fp, const FSSpec *spec);
- void FileSetSys(FileType *fp, const FileNameType name);
- void FileSetPref(FileType *fp, const FileNameType name);
- void FileSetExtension(FileType *fp, const FileNameType name);
- void FileSetTemp(FileType *fp);
-
- void FileClone(FileType *src, FileType *dst);
-
- void FileOpen(FileType *fp, FilePermType permission);
- void FileOpenRes(FileType *fp, FilePermType permission);
- void FileClose(FileType *fp);
-
- FilePosType FilePosition(FileType *fp);
- void FileSeek(FileType *fp, FileSeekType seek, FilePosType position);
- FilePosType FileSize(FileType *fp);
- void FileResize(FileType *fp, FilePosType size);
-
- void FileAutoLockSet(FileType *fp, Boolean lock);
- void FileVerifySet(FileType *fp, Boolean verify);
- void FileRangeLock(FileType *fp, FilePosType count, FilePosType pos);
- void FileRangeUnlock(FileType *fp, FilePosType count, FilePosType pos);
-
- FilePosType FileRead(FileType *fp, FilePosType count, void *buffer);
- void FileWrite(FileType *fp, FilePosType count, const void *buffer);
- Boolean FileReadChar(FileType *fp, char *c);
- void FileWriteChar(FileType *fp, char c);
- FilePosType FileReadStr(FileType *fp, FilePosType count, char *str, char stop);
- FilePosType FileReadLine(FileType *fp, FilePosType count, char *line);
- void FileWriteStr(FileType *fp, const char *str);
-
- void FileFlush(FileType *fp);
-
- OSType FileCreator(FileType *fp);
- OSType FileTypeGet(FileType *fp);
- void FileInfoGet(FileType *fp, FInfo *info);
- void FileInfoSet(FileType *fp, FInfo *info);
- void FileCatalog(FileType *fp, CInfoPBRec *pb);
- void FileCatalogSet(FileType *fp, CInfoPBRec *pb);
-
- void FileCreate(FileType *fp, OSType creator, OSType type);
- void FileDelete(FileType *fp);
- void FileErase(FileType *fp);
- void FileRename(FileType *fp, const FileNameType newname);
-
- void FileDirID(FileType *fp);
- Boolean FilesAreSame(FileType *a, FileType *b);
- Boolean FileExists(FileType *fp);
- void FileUniqueInList(FileNameType name, ...);
- void FileUnique(FileType *fp);
-
- void FileCopyFork(FileType *src, FileType *dst);
- void FileCopyData(FileType *src, FileType *dst);
- void FileCopyRes(FileType *src, FileType *dst);
- void FileCopy(FileType *src, FileType *dst);
- void FileMove(FileType *src, FileType *dst);
- void FileExchange(FileType *f1, FileType *f2);
-